<template>
    <div class="reportTabs">
        <div class="left">
            <span v-for="item in tabDatas" :key="item.id" class="tab-item" :class="{'active': curTab === item.id}" @click="changeTab(item)">{{ item.label }}</span>
        </div>
        <div class="right"> 
            <div class="exportBtn" @click="exportFile" v-show="isExport">
                <i class="iconfont icon-daochu icon"></i>
                <span class="text">导出</span>
            </div>
        </div>
    </div>
</template>

<script setup>

const props = defineProps({
    curTab: {
        type: String,
        default: '1'
    },
    tabDatas: {
        type: Array,
        default: () => []
    },
    isExport: {
        type: Boolean,
        default: true
    }
});

const emit = defineEmits(['handleExport', 'updateTab']);

const exportFile = () => {
    emit('handleExport');
};

const changeTab = ({id}) => {
    emit('updateTab', id);
};
</script>

<style lang="scss" scoped>
@import url('./index.scss');
</style>